Skip to content

Fix cross-device link error when updating lazygit (#3494) - #6250

Closed
isFakeAccount wants to merge 1 commit into
jesseduffield:masterfrom
isFakeAccount:master
Closed

isFakeAccount wants to merge 1 commit into
jesseduffield:masterfrom
isFakeAccount:master

Conversation

@isFakeAccount

@isFakeAccount isFakeAccount commented Nov 27, 2026 •

Copy link
Copy Markdown

PR Description

  • Fixes the invalid cross-device link caused when copying files to different disk on Linux.
  • Instead of extracting downloaded zip file to current directory. Everything is now done in tmpdir from download to extraction.
  • Separated out the download function since otherwise the defer on out is pretty much pointless as it only was getting called at the end of the function
  • Separated out move function which now copies the file in case cross device link error then it renames the file to the lazygit exe
  • Added a timeout on the HTTPs function, right now the timeout value is 3 minutes which should be more than enough.

Please check if the PR fulfills these requirements

  • [O] Cheatsheets are up-to-date (run go generate ./...)
  • [O] Code has been formatted (see here)
  • [O] Tests have been added/updated (see here for the integration test guide)
  • [O] Text is internationalised (see here)
  • [O] If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • [O] Docs have been updated if necessary
  • [O] You've read through your own file changes for silly mistakes etc

…evice link

- Fixes the invalid cross-device link caused when copying files to
different disk on Linux.
- Instead of extracting lazygit to current directory, everything is now
done in tmpdir
- On top of that, there is a fallback which copies the file and then
renames the file in case the executable location and the tmp dir are on
different disks
@stefanhaller

Copy link
Copy Markdown
Collaborator

This is not nearly enough to fix all the problems that the update code currently has. I'm rewriting it from scratch, and it will include a fix for this issue.

@isFakeAccount

Copy link
Copy Markdown
Author

If you are gonna rewrite it can you make it follow the XDG base dir specification?

Install the binary in the ~/.local/bin on Linux. ~/bin for Macos. Idk for windows.

Also how much longer the rewrite will take?

@stefanhaller

Copy link
Copy Markdown
Collaborator

If you are gonna rewrite it can you make it follow the XDG base dir specification?

Install the binary in the ~/.local/bin on Linux. ~/bin for Macos. Idk for windows.

I don't understand the question. Lazygit doesn't decide where the install goes; it always installs over the running binary, wherever it is, as long as you have write permissions there. But yes, the readme will recommend ~/.local/bin for manual installs on Linux.

Also how much longer the rewrite will take?

It will be included in the next release.

@stefanhaller

Copy link
Copy Markdown
Collaborator

BTW, where does the ~/bin for macOS come from? I can't find any reference to it anywhere, and the XDG spec doesn't say that (but it doesn't apply to macOS anyway, as far as I can see).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants